Unity Essentials: Foundations of real-time audio
from ✅Unity Essentials: Get started with Unity
Unity Essentials: Foundations of real-time audio
BGMの追加
Create Empty→Audio Sourceコンポーネントを追加→Audio Clipをattach
3Dの音
Audio listenerを使う
カメラが目だとすると、耳に相当
デフォルトではカメラに装着されている
Unity sceneに1つだけ
普通につけるだけだと2Dの音だが簡単に3D(locationに合わせて音が減衰する)にできる
https://gyazo.com/649a6dfb70caea22debe9ae27fbf973a
減衰具合をRolloffで調整できる
https://gyazo.com/cbadd893560603455e5a50821e06f6d2
https://gyazo.com/9d732155f7a14d5731fe5d5ef78d029c
Maxより中/外は一定音量
Audio DCCツール
Audition, Logic Pro, Reaper, and Audacityみたいなやつ
Unityは3Dのオーディオをシミュレートできる。ドップラー効果もシミュレートできる
BGMの重要性を知る実験をやった
Asset store
https://learn.unity.com/tutorial/get-audio-assets?uv=2019.4
対応オーディオ
https://docs.unity3d.com/Manual/AudioFiles.html
サイレンの音が必要らしいのでこれを入れた
https://assetstore.unity.com/packages/audio/sound-fx/transportation/vehicle-essentials-194951
キッチンの窓の外のオブジェクトをを動かす課題
https://learn.unity.com/tutorial/challenge-moving-sound?uv=2019.4
移動するGameObjectを作成
Game ObjectにAudio Source Componentを追加
Audio Source ComponentにAudio Clipを追加
ドップラー効果の作成
Game ObjectにUnity Scriptを追加して動かす
code:cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarTransform : MonoBehaviour
{
public Vector3 positionChange;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position += positionChange;
}
}
https://learn.unity.com/tutorial/challenge-moving-sound-1
iCloud private relayを使うとSafariでUnity asset storeを開けない
音はLoopにする